<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <meta http-equiv="X-UA-Compatible" content="ie=edge" />
  <title>Document</title>
</head>
<body>




<script>
    // class static
    // 1.0.1 创建动物类
    class Animal {
      constructor (name, age) {
        this.name = name
        this.age = age
      }
      eat () {
        console.log('吃吃吃')
      }
      static run () {
        console.log('跑跑跑')
      }
    }

    let gou = new Animal('小狗', 1)
    Animal.max_age = 100
    console.log(gou)
    gou.eat()
    console.log(Animal.max_age)
    Animal.run()

    // 2.0 类的继承
    class Person extends Animal {
      constructor (name, age, height) {
        super(name, age)
        this.height = 180
      }
      study () {
        console.log('学习')
      }
    }
    // 2.0.2 实例类
    var p1 = new Person('小米', 8)
    console.log(p1, '输出实例对象')
    p1.eat()
    console.log(Person.max_age)
    Person.run()
</script>
</body>
</html>
